<template>
  <ul class="ulProList">
    <li v-for="item in list" :key="item.id" @click="goDetail(item.id)">
      <div class="image"><img :src="item.cover" alt="图片"/></div>
      <div class="info">
        <h4>{{item.title}}</h4>
        <p>价格：{{item.price}}元</p>
        <p>时间：{{item.create_date}}</p>
      </div>
    </li>
  </ul>
</template>

<script>
import router from '../router'

export default {
  props: {
    productData:Array
  },
  data () {
    return {
      list:[]
    }
  },
  methods: {
    goDetail(id){
      this.$store.commit('historyProAdd',id);
      router.push('/product/'+id);
    }
  },
  mounted: function () {
    this.$watch('productData', function(newVal, oldVal){
      this.list = newVal;
    });
  }
}
</script>

<style lang="less" rel="stylesheet/less">
</style>
